<?php $_banners = \TechOnline\Laravel\Dao\ModelUtil::all('banner',[],['*'],['sort','asc']); ?>
<div class="pb-banner swiper-container">
    <div class="swiper-wrapper">
        @foreach($_banners as $banner)
            <a class="swiper-slide"
               style="background-image:url({{\TechSoft\Laravel\Assets\AssetsUtil::fix($banner['image'])}});"
               @if($banner['link']) href="{{$banner['link']}}" target="_blank"
               @else href="javascript:;" @endif></a>
        @endforeach
    </div>
    <div class="swiper-pagination swiper-pagination-white"></div>
    <div class="swiper-button-next swiper-button-white uk-hidden-small"></div>
    <div class="swiper-button-prev swiper-button-white uk-hidden-small"></div>
</div>
<script>
    $(function () {
        var swiper = new Swiper('.pb-banner', {
            pagination: '.swiper-pagination',
            paginationClickable: '.swiper-pagination',
            nextButton: '.swiper-button-next',
            prevButton: '.swiper-button-prev',
            loop: true,
            autoplay: 2500,
            autoplayDisableOnInteraction: false
        });
        $('.pb-banner').hover(function(){
            swiper.stopAutoplay();
        },function(){
            swiper.startAutoplay();
        });
    });
</script>
